/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.provider;

import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.util.InteractionprotocolsAdapterFactory;

import java.util.ArrayList;
import java.util.Collection;

import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.Notifier;

import org.eclipse.emf.edit.provider.ChangeNotifier;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.provider.IChangeNotifier;
import org.eclipse.emf.edit.provider.IDisposable;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.INotifyChangedListener;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;

/**
 * This is the factory that is used to provide the interfaces needed to support Viewers.
 * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}.
 * The adapters also support Eclipse property sheets.
 * Note that most of the adapters are shared among multiple instances.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public class InteractionprotocolsItemProviderAdapterFactory extends InteractionprotocolsAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable {
	/**
	 * This keeps track of the root adapter factory that delegates to this adapter factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ComposedAdapterFactory parentAdapterFactory;

	/**
	 * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected IChangeNotifier changeNotifier = new ChangeNotifier();

	/**
	 * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected Collection<Object> supportedTypes = new ArrayList<Object>();

	/**
	 * This constructs an instance.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public InteractionprotocolsItemProviderAdapterFactory() {
		supportedTypes.add(IEditingDomainItemProvider.class);
		supportedTypes.add(IStructuredItemContentProvider.class);
		supportedTypes.add(ITreeItemContentProvider.class);
		supportedTypes.add(IItemLabelProvider.class);
		supportedTypes.add(IItemPropertySource.class);
	}

	/**
	 * This keeps track of the one adapter used for all {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.BusinessMessage} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected BusinessMessageItemProvider businessMessageItemProvider;

	/**
	 * This creates an adapter for a {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.BusinessMessage}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createBusinessMessageAdapter() {
		if (businessMessageItemProvider == null) {
			businessMessageItemProvider = new BusinessMessageItemProvider(this);
		}

		return businessMessageItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.InteractionProtocol} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected InteractionProtocolItemProvider interactionProtocolItemProvider;

	/**
	 * This creates an adapter for a {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.InteractionProtocol}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createInteractionProtocolAdapter() {
		if (interactionProtocolItemProvider == null) {
			interactionProtocolItemProvider = new InteractionProtocolItemProvider(this);
		}

		return interactionProtocolItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.InteractionPath} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected InteractionPathItemProvider interactionPathItemProvider;

	/**
	 * This creates an adapter for a {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.InteractionPath}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createInteractionPathAdapter() {
		if (interactionPathItemProvider == null) {
			interactionPathItemProvider = new InteractionPathItemProvider(this);
		}

		return interactionPathItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Lifeline} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected LifelineItemProvider lifelineItemProvider;

	/**
	 * This creates an adapter for a {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Lifeline}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createLifelineAdapter() {
		if (lifelineItemProvider == null) {
			lifelineItemProvider = new LifelineItemProvider(this);
		}

		return lifelineItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Termination} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected TerminationItemProvider terminationItemProvider;

	/**
	 * This creates an adapter for a {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Termination}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createTerminationAdapter() {
		if (terminationItemProvider == null) {
			terminationItemProvider = new TerminationItemProvider(this);
		}

		return terminationItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Condition} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ConditionItemProvider conditionItemProvider;

	/**
	 * This creates an adapter for a {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Condition}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createConditionAdapter() {
		if (conditionItemProvider == null) {
			conditionItemProvider = new ConditionItemProvider(this);
		}

		return conditionItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.TimeConstraint} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected TimeConstraintItemProvider timeConstraintItemProvider;

	/**
	 * This creates an adapter for a {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.TimeConstraint}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createTimeConstraintAdapter() {
		if (timeConstraintItemProvider == null) {
			timeConstraintItemProvider = new TimeConstraintItemProvider(this);
		}

		return timeConstraintItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.TimeObservation} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected TimeObservationItemProvider timeObservationItemProvider;

	/**
	 * This creates an adapter for a {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.TimeObservation}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createTimeObservationAdapter() {
		if (timeObservationItemProvider == null) {
			timeObservationItemProvider = new TimeObservationItemProvider(this);
		}

		return timeObservationItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.ProtocolReference} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ProtocolReferenceItemProvider protocolReferenceItemProvider;

	/**
	 * This creates an adapter for a {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.ProtocolReference}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createProtocolReferenceAdapter() {
		if (protocolReferenceItemProvider == null) {
			protocolReferenceItemProvider = new ProtocolReferenceItemProvider(this);
		}

		return protocolReferenceItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Correlation} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected CorrelationItemProvider correlationItemProvider;

	/**
	 * This creates an adapter for a {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Correlation}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createCorrelationAdapter() {
		if (correlationItemProvider == null) {
			correlationItemProvider = new CorrelationItemProvider(this);
		}

		return correlationItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Role} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected RoleItemProvider roleItemProvider;

	/**
	 * This creates an adapter for a {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Role}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createRoleAdapter() {
		if (roleItemProvider == null) {
			roleItemProvider = new RoleItemProvider(this);
		}

		return roleItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.And} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected AndItemProvider andItemProvider;

	/**
	 * This creates an adapter for a {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.And}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createAndAdapter() {
		if (andItemProvider == null) {
			andItemProvider = new AndItemProvider(this);
		}

		return andItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Or} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected OrItemProvider orItemProvider;

	/**
	 * This creates an adapter for a {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Or}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createOrAdapter() {
		if (orItemProvider == null) {
			orItemProvider = new OrItemProvider(this);
		}

		return orItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Xor} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected XorItemProvider xorItemProvider;

	/**
	 * This creates an adapter for a {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Xor}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createXorAdapter() {
		if (xorItemProvider == null) {
			xorItemProvider = new XorItemProvider(this);
		}

		return xorItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.If} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected IfItemProvider ifItemProvider;

	/**
	 * This creates an adapter for a {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.If}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createIfAdapter() {
		if (ifItemProvider == null) {
			ifItemProvider = new IfItemProvider(this);
		}

		return ifItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Loop} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected LoopItemProvider loopItemProvider;

	/**
	 * This creates an adapter for a {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Loop}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createLoopAdapter() {
		if (loopItemProvider == null) {
			loopItemProvider = new LoopItemProvider(this);
		}

		return loopItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Exception} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ExceptionItemProvider exceptionItemProvider;

	/**
	 * This creates an adapter for a {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Exception}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createExceptionAdapter() {
		if (exceptionItemProvider == null) {
			exceptionItemProvider = new ExceptionItemProvider(this);
		}

		return exceptionItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Cancel} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected CancelItemProvider cancelItemProvider;

	/**
	 * This creates an adapter for a {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Cancel}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createCancelAdapter() {
		if (cancelItemProvider == null) {
			cancelItemProvider = new CancelItemProvider(this);
		}

		return cancelItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.MultipleInstance} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected MultipleInstanceItemProvider multipleInstanceItemProvider;

	/**
	 * This creates an adapter for a {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.MultipleInstance}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createMultipleInstanceAdapter() {
		if (multipleInstanceItemProvider == null) {
			multipleInstanceItemProvider = new MultipleInstanceItemProvider(this);
		}

		return multipleInstanceItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Transaction} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected TransactionItemProvider transactionItemProvider;

	/**
	 * This creates an adapter for a {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Transaction}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createTransactionAdapter() {
		if (transactionItemProvider == null) {
			transactionItemProvider = new TransactionItemProvider(this);
		}

		return transactionItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Compensation} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected CompensationItemProvider compensationItemProvider;

	/**
	 * This creates an adapter for a {@link ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Compensation}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createCompensationAdapter() {
		if (compensationItemProvider == null) {
			compensationItemProvider = new CompensationItemProvider(this);
		}

		return compensationItemProvider;
	}

	/**
	 * This returns the root adapter factory that contains this factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ComposeableAdapterFactory getRootAdapterFactory() {
		return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory();
	}

	/**
	 * This sets the composed adapter factory that contains this factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
		this.parentAdapterFactory = parentAdapterFactory;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean isFactoryForType(Object type) {
		return supportedTypes.contains(type) || super.isFactoryForType(type);
	}

	/**
	 * This implementation substitutes the factory itself as the key for the adapter.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter adapt(Notifier notifier, Object type) {
		return super.adapt(notifier, this);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object adapt(Object object, Object type) {
		if (isFactoryForType(type)) {
			Object adapter = super.adapt(object, type);
			if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) {
				return adapter;
			}
		}

		return null;
	}

	/**
	 * This adds a listener.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void addListener(INotifyChangedListener notifyChangedListener) {
		changeNotifier.addListener(notifyChangedListener);
	}

	/**
	 * This removes a listener.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void removeListener(INotifyChangedListener notifyChangedListener) {
		changeNotifier.removeListener(notifyChangedListener);
	}

	/**
	 * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void fireNotifyChanged(Notification notification) {
		changeNotifier.fireNotifyChanged(notification);

		if (parentAdapterFactory != null) {
			parentAdapterFactory.fireNotifyChanged(notification);
		}
	}

	/**
	 * This disposes all of the item providers created by this factory. 
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void dispose() {
		if (businessMessageItemProvider != null) businessMessageItemProvider.dispose();
		if (interactionProtocolItemProvider != null) interactionProtocolItemProvider.dispose();
		if (interactionPathItemProvider != null) interactionPathItemProvider.dispose();
		if (lifelineItemProvider != null) lifelineItemProvider.dispose();
		if (terminationItemProvider != null) terminationItemProvider.dispose();
		if (conditionItemProvider != null) conditionItemProvider.dispose();
		if (timeConstraintItemProvider != null) timeConstraintItemProvider.dispose();
		if (timeObservationItemProvider != null) timeObservationItemProvider.dispose();
		if (protocolReferenceItemProvider != null) protocolReferenceItemProvider.dispose();
		if (correlationItemProvider != null) correlationItemProvider.dispose();
		if (roleItemProvider != null) roleItemProvider.dispose();
		if (andItemProvider != null) andItemProvider.dispose();
		if (orItemProvider != null) orItemProvider.dispose();
		if (xorItemProvider != null) xorItemProvider.dispose();
		if (ifItemProvider != null) ifItemProvider.dispose();
		if (loopItemProvider != null) loopItemProvider.dispose();
		if (exceptionItemProvider != null) exceptionItemProvider.dispose();
		if (cancelItemProvider != null) cancelItemProvider.dispose();
		if (multipleInstanceItemProvider != null) multipleInstanceItemProvider.dispose();
		if (transactionItemProvider != null) transactionItemProvider.dispose();
		if (compensationItemProvider != null) compensationItemProvider.dispose();
	}

}
